import axios from 'axios';
import {PageParams, PageRes} from "@/api/common";

const baseUrl = '/sc/${busName}/';
const apis = {
queryPage:`${r"${baseUrl}"}page`,
delete:`${r"${baseUrl}"}delete`,
addForm: `${r"${baseUrl}"}add`,
editForm: `${r"${baseUrl}"}edit`,
detail: `${r"${baseUrl}"}detail`
};


export interface ${busName?cap_first}Model {
<#list columnRows as columnRow>
${columnRow.fieldName}?:undefined
</#list>
}


export function queryPage(params: PageParams) {
   return axios.post<PageRes>(apis.queryPage, params);
}

export function removeRow(rowId: string) {
   return axios.delete<string>(`${r"${apis.delete}"}?id=${r"${rowId}"}`);
}


export function addForm(param:any) {
   return axios.post<string>(apis.addForm,param);
}

export function editForm(param:any) {
   return  axios.post<string>(apis.editForm,param);
}

export function detail(rowId:string) {
   return axios.get<any>(`${r"${apis.detail}"}?id=${r"${rowId}"}`);
}